﻿<%@ Page Language="C#"  MasterPageFile="~/main.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="TipCalcWebApp._default" %>
<asp:Content ID="Content4" ContentPlaceHolderID="headContent" runat="server">
    <link href="styles/tipcalc.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="headerContent" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ScriptManagerMain" runat="server">
    </ajaxToolkit:ToolkitScriptManager>
    <h1>Online Tip Calculator</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyContent" runat="server">
    <div class="TipEntryLine">
        <label for="AmountTextBox" class="LeftSideLabel">Bill Amount:</label>
        <asp:TextBox id="AmountTextBox" runat="server" CssClass="RightSideEntry" 
            MaxLength="7"/>
        <ajaxToolkit:FilteredTextBoxExtender ID="FilterAmount" runat="server" 
            FilterType="Custom, Numbers" TargetControlID="AmountTextBox" ValidChars=".">
        </ajaxToolkit:FilteredTextBoxExtender>
        <asp:RequiredFieldValidator ID="RequiredAmount" runat="server" 
            ErrorMessage="Bill Amount is required." CssClass="ErrorMessage"
            Display="None" ControlToValidate="AmountTextBox" SetFocusOnError="true">
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="RegexAmount" runat="server" 
            ErrorMessage="Bill Amount must be in ###.## format." SetFocusOnError="True"
            ControlToValidate="AmountTextBox" ValidationExpression="^\d+(\.\d\d)?$" Display="None">
        </asp:RegularExpressionValidator>
    </div>
    <div class="TipEntryLine">
        <label for="TipPercentageTextBox" class="LeftSideLabel">Tip Percentage:</label>
        <asp:TextBox id="TipPercentageTextBox" runat="server" CssClass="RightSideEntry" 
            MaxLength="3" />
        <ajaxToolkit:FilteredTextBoxExtender ID="FilterPercentToTip" runat="server" 
            FilterType="Numbers" TargetControlID="TipPercentageTextBox" >
        </ajaxToolkit:FilteredTextBoxExtender>
        <asp:RequiredFieldValidator ID="RequiredTipPercentage" runat="server" 
            ErrorMessage="Tip percentage is required." CssClass="ErrorMessage"
            Display="None" ControlToValidate="TipPercentageTextBox" SetFocusOnError="True">
        </asp:RequiredFieldValidator>
        <asp:RangeValidator ID="RangeValidation" runat="server" 
            ErrorMessage="Tip percentage must be between 0 and 100." ControlToValidate="TipPercentageTextBox"
            MinimumValue="0" MaximumValue="100" SetFocusOnError="true" Type="Integer" Display="None">
        </asp:RangeValidator>
    </div>
    <div class="TipEntryLine">
        <span class="LeftSideLabel">&nbsp;</span>
        <div class="RightSideButtonContainer">
            <asp:Button id="CalculateButton" Text="Calculate" runat="server" 
                CssClass="RightSideButton" onclick="CalculateButton_Click" />
        </div>
    </div>
    <hr class="BodyWidth" />
    <div class="TipEntryLine">
        <asp:Label Text="Tip Amount:" runat="server" CssClass="LeftSideLabel"  />
        <asp:Label id="TipAmountLabel" runat="server" CssClass="RightSideLabel">&nbsp;</asp:Label>
    </div>
    <div class="TipEntryLine" style="height:30px;"></div>
    <asp:ValidationSummary ID="ErrorSummary" runat="server" CssClass="ErrorMessage"
        HeaderText="<span class='ErrorHeader'>Please correct the following errors:</span><br />" 
        DisplayMode="List" />
</asp:Content>
